﻿using GameFramework.buff;
using UnityEngine;

namespace GameFramework.skill.effect.impl
{
    public class AddBuffSkillEffect:ISkillEffect
    {
        public EffectConfig effectConfig;
        public void excute(Skill skill)
        {
            Debug.Log("增加buff效果");
            float[] values = effectConfig.values;
            int buffid = (int)values[0];
            BuffConfig buffConfig = BuffConfigManager.Instance.getConfig(buffid);
            PropertyModifierBuff modifierBuff = new PropertyModifierBuff();
            modifierBuff.id = buffConfig.id;
            modifierBuff.buffConfig = buffConfig;
            modifierBuff.skill = skill;
            foreach (Transform transform in skill.targets)
            {
                modifierBuff.holder = transform.gameObject;
                BuffManager buffManager = transform.gameObject.GetComponent<BuffManager>();
                buffManager.addBuff(modifierBuff);
            }
        }
    }
}